<?php 
//设置标题
$_title="新建项目";
include_once("../header.php")
 ?>
<body class="metrouicss">
  <style>
   sponsorBlock li
   {
     font-size:14px;
     margin:10px;
   }
  </style>
    <!-- 引入javascript -->
    <script type="text/javascript" src="../../js/jqplot/jquery.jqplot.min.js"></script>
    <link href="../../js/jqplot/jquery.jqplot.min.css" type="text/css" rel="stylesheet"></link>
    <?php 
    $srcNames = array("dateAxisRenderer","canvasTextRenderer","canvasAxisTickRenderer","categoryAxisRenderer","barRenderer");
    foreach($srcNames as $src)
    {
    ?>
    <script type="text/javascript" src="../../js/jqplot/plugins/<?= "jqplot.".$src.".min.js" ?>" ></script>
    <?php } ?>
    <!-- top -->
    <?php include_once("../menu.php") ?>
    <div id="page-index" class="page">
      <div class="page-region">
        <div class="page-region-content">
          <!-- grid1 -->
          <div class="grid">
            <!-- 图表展示 -->
            <div class="row">
              
              <!-- 图表 -->
              <div class="span8">
                  <div id="chart1" style="background:#F1F1F1;">
                  </div>
              </div>
              
              <!-- 项目统计 -->
              <div class="span4">
                <div id="sponsorBlock" class="span4 padding30  bg-color-blueLight">
                  <br/><br/>                  
                  <h2>统计类型</h2>
                  <ul>
                    <li><a>年度</a></li>
                    <li><a>月度</a></li>
                    <li><a>最近三年</a></li>
                    <li><a>最近三个月</a></li>
                    <li><a>更多.....</a></li>
                  </ul>
                  <br/>
                </div>
              </div>
              
            </div>
          </div>
          
          
          <div class="grid">
            <!-- 表单输入 -->
            <div class="row">
              
              <!-- 表单 -->
              <div class="span6">
                <div  class="">
                  <form method="POST" action="../../ctl/index.php?ctl=Project&ac=addRec">
                    <fieldset>
                      <legend>项目信息</legend>
                    <div class="input-control text">
                      项目名称
                      <input type="text" name="strname"/>
                      <button class="helper"></button>
                    </div>
                    <div class="input-control text">
                      负责人
                      <input type="text" name="strduty"/>
                      <button class="helper"></button>
                    </div>
                    <div class="input-control text">
                      预计完成时间
                      <input type="text" name="dtexpect"/>
                      <button class="helper"></button>
                    </div>
                    <div class="input-control textarea">
                      备注
                      <textarea name="strdemo"></textarea>
                    </div>
                    <input type="submit" value="提交" onclick="return addRec()"/>
                    <input type="reset" value="重置"/>
                    </fieldset>
                  </form>
                </div>
              </div>
              
              <!-- 帮助信息 -->
              <div class="span6">
                <div class="">
                  <h2>小贴示</h2>
                  
                  <div class="notices">
                    <div class="bg-color-green">
                      <a href="#" class="close"></a>
                      <div class="notice-icon"><i class="icon-accessibility"></i></div>
                      <div class="notice-image"><i class="icon-accessibility" style="font-size:50px;"></i> </div>
                      <div class="notice-header fg-color-white">项目管理 </div>
                      <div class="notice-text"> 项目管理可以时时跟踪项目进度 </div>
                    </div>
                  </div>
                  <!-- 带标签的回复 -->
                  <ul class="replies" style="display:none">
                    <li class="bg-color-orange">
                      <b class="sticker sticker-left sticker-color-orange"></b>
                      <div class="avatar"><i class="icon-finder" style="color:green;font-size:40px;"></i></div>
                      <div class="reply">
                        <div class="date">2013-12-12</div>
                        <div class="author">Hi,admin</div>
                        <div class="text">
                          <a id="proLink" href="#" style="color:white;font-size:18px;">恭喜，新建了一个项目
                            <i class="icon-arrow-right-3"></i>
                          </a>
                        </div>
                      </div>
                    </li>
                  </ul>
                  
                </div>
              </div>
              
            </div>
          </div>           
        
        </div>
      </div>
    </div>
    <?php include_once("../bottom.php") ?>
    <script>
     $(document).ready(function(){
       /*
       var line1 = [['一月', 7], ['二月', 9], ['三月', 15],
                    ['四月', 12], ['五月', 3],
                    ['六月', 6],['七月',0],['八月',10],['九月',1]];
       */
       $.ajax({
         url:'../../ctl/index.php?ctl=Project&ac=sum',
         method:'get',
         dataType:'json',
         success:function(data){
           if(data.status == 'suc')
           {
             loadProject(data.line);
           }
         },
         error:function(){}
       });
     });
     function loadProject(line)
     {
       var plot1 = $.jqplot('chart1', [line], {
         title: '项目建设情况',
         series:[{renderer:$.jqplot.BarRenderer}],
         axesDefaults: {
           tickRenderer: $.jqplot.CanvasAxisTickRenderer ,
           tickOptions: {
             angle: -30,
             fontSize: '10pt'
           }
         },
         axes: {
           xaxis: {
             renderer: $.jqplot.CategoryAxisRenderer
           }
         }
       });
     }
     function addRec()
     {
       $.ajax({
         url:'../../ctl/index.php?ctl=Project&ac=addRec',
         method:'POST',
         dataType:'json',
         data:$("form:first").serialize(),
         success:function(data){
           if(data.status=='suc')
           {
             $("#proLink").attr("href","./projectInfo.php?strproid="+data.strproid);
             $("form:first input").each(function(i){
               if($(this).attr("type")=="text")$(this).replaceWith("<p><i class='icon-arrow-right' style='font-size:25px;'></i><a style='font-size:30px;'>&nbsp;&nbsp;&nbsp;"+$(this).val()+"</a></p>");
               else 
               $(this).hide();
             });
             $("form:first textarea").each(function(i){$(this).replaceWith("<p><i class='icon-tag' style='font-size:25px;'></i><a style='font-size:30px;'>&nbsp;&nbsp;&nbsp;"+$(this).val()+"</a></p>")});
             $("form:first button").each(function(i){$(this).hide();});
             $("ul.replies").css("display","block");
           }
         },
         error:function(){
           alert("出错了，请查看错误信息");
         }
       });
       return false;
     }
    </script>
  </body>
</html>